package com.example.shop_2211.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.GoodsBean
import com.example.shop_2211.R
import com.example.shop_2211.utils.GlideUtils

class GoodsMutiAdapter:BaseMultiItemQuickAdapter<GoodsBean,BaseViewHolder>() {
    init {
        addItemType(0, R.layout.item_goods)
        addItemType(1,R.layout.item_goods)
    }
    override fun convert(holder: BaseViewHolder, item: GoodsBean) {
        when (holder.itemViewType){
            0->{
                GlideUtils.loadImage(context,item.image,holder.getView(R.id.goods_image))
                holder.setText(R.id.goods_name,item.storeName)
                holder.setText(R.id.goods_price,"价格：￥${item.price}")
                holder.setText(R.id.goods_sales,"销量：${item.sales+item.ficti}")
            }
            1->{
                GlideUtils.loadCircleImage(context,item.image,holder.getView(R.id.goods_image))
                holder.setText(R.id.goods_name,item.storeName)
                holder.setText(R.id.goods_price,"价格：￥${item.price}")
                holder.setText(R.id.goods_sales,"销量：${item.sales+item.ficti}")
            }
        }
    }
}